/*****************************************************************************
*
* File: spi.h
*
* Description: Header file for spi_sseg.c
*
* Author: Kevin Casteel, Luis Castillo
*
* Revisions: v-1.0 (4/20/11)
*            v-1.1 (4/22/11)
*
******************************************************************************/

#ifndef _SPI_H
#define _SPI_H

#include <stdint.h>


//----------------------------------------------
//- This driver uses the following:  
//-    PB4 as the chip select (arbitrary) 
//-    PB5 as the MOSI output
//-    PB7 as the clock output
//----------------------------------------------
#define SPI_SS     4
#define SPI_MOSI   5
#define SPI_SCK    7


//--------------------------------------------------------------
//- Function: SPI_MasterInit()
//- 
//- return value: none
//- parameters: none
//-
//- Description: Initializes the AVR device as a master and 
//- and turns on the device and sets the clock frequency. 
//- For convenience, this function also configures the SPI
//- port GPIOs
//---------------------------------------------------------------
void SPI_MasterInit(void); 



//--------------------------------------------------------------
//- Function: SPI_MasterTransmit()
//- 
//- return value: none
//- parameters: data to be transmitted
//-
//- Description: This function selects the device, transmits
//- the data, waits for a the transmission to complete with 
//- a poll, then deselects the device. 
//---------------------------------------------------------------
void SPI_MasterTransmit(uint8_t data); 


#endif
